<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./lib/react.development.js"></script>
    <script src="./lib/react-dom.development.js"></script>
    <script src="./lib/babel.min.js"></script>
</head>
<body>
<div id="root">

</div>

</body>
<script type="text/babel">
    // 父组件向子组件传递参数：
    // 1- 父组件如何传
    // 2- 子组件如何接收
    const root = ReactDOM.createRoot(document.querySelector("#root"));
    // 父组件:通过属性传递参数
    const App = ()=>(
        <div>
            <h3>App</h3>
            <Child style={{color:"red"}} className={"my"} a={1} b={"2"} c={true}/>
        </div>
    )
    // 子组件:通过参数
    const Child= props =>{
        // props是一个对象，对象中的属性即是父组件传递过来的数据
        console.log(props);// {style:{color:"red"},className="my",a:1,b:"2",c:true}
        return (
            <div>
                <h3>Child</h3>
            </div>
        )
    }
    root.render(<App/>)
</script>
</html>